/**
 * Creating a sidebar enables you to:
 - create an ordered group of docs
 - render a sidebar for each doc of that group
 - provide next/previous navigation

 The sidebars can be generated from the filesystem, or explicitly defined here.

 Create as many sidebars as you want.
 */

// @ts-check

/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
const sidebars = {
  // By default, Docusaurus generates a sidebar from the docs folder structure
  tutorialSidebar: [{ type: "autogenerated", dirName: "." }],
  faq: ["faq"],

  reference: [
    "reference/overview",
    "reference/server",
    "reference/client",

    // Routing subsection
    {
      type: "category",
      label: "Routing",
      collapsed: false,
      items: [
        "reference/routing/routes",
        "reference/routing/route_pattern",
        "reference/routing/path_codec",
      ],
    },
    "reference/handler",
    {
      type: "category",
      label: "HTTP Messages",
      collapsed: false,
      items: [
        "reference/request",
        "reference/response/response",
        "reference/response/status",
        {
          type: "category",
          label: "Headers",
          items: [
            "reference/headers/headers",
            "reference/headers/session/cookies",
            "reference/headers/session/flash",
          ],
        },
        {
          type: "category",
          label: "Message Body",
          items: [
            "reference/body/body",
            "reference/body/form",
            "reference/body/binary_codecs",
            "reference/body/template",
          ],
        },
      ],
    },
    {
      type: "category",
      label: "Declarative Endpoints",
      collapsed: false,
      items: ["reference/endpoint", "reference/http-codec"],
    },

    // Aspects subsection
    {
      type: "category",
      label: "Aspects",
      items: [
        "reference/aop/protocol-stack",
        "reference/aop/middleware",
        "reference/aop/handler_aspect",
      ],
    },

    // Contextual Data Types
    {
      type: "category",
      label: "Request-scoped Context",
      link: { type: 'doc', id: "reference/contextual/index" },
      items: [
        "reference/contextual/request-store",
        "reference/contextual/zio-environment",
      ],
    },

    // WebSocket subsection
    {
      type: "category",
      label: "WebSocket",
      items: ["reference/socket/socket", "reference/socket/websocketframe"],
    },

    // Configs subsection
    {
      type: "category",
      label: "Configs",
      items: [
        "reference/configs/introduction",
        "reference/configs/connection-pool",
        "reference/configs/dns-resolver",
        "reference/configs/server",
        "reference/configs/openapi",
        "reference/configs/netty",
      ],
    },
    "reference/datastar-sdk/index"
  ],

  examples: [
    //            "examples/index",
    "examples/hello-world",
    "examples/http-client-server",
    "examples/https-client-server",
    "examples/serving-static-files",
    "examples/html-templating",
    "examples/websocket",
    "examples/streaming",
    "examples/endpoint",
    "examples/endpoint-scala3",
    "examples/middleware-cors-handling",
    "examples/authentication",
    "examples/graceful-shutdown",
    "examples/cli",
    "examples/concrete-entity",
    "examples/multipart-form-data",
    "examples/server-sent-events-in-endpoints",
  ],
  guides: [
    "guides/integration-with-zio-config",
    "guides/testing-http-apps",
    {
       type: "category",
       collapsed: false,
       label: "Authentication",
       items: [
          "guides/basic-authentication",
          "guides/cookie-based-authentication",
          "guides/digest-authentication",
          "guides/authentication-with-opaque-bearer-tokens",
          "guides/authentication-with-jwt-bearer-tokens",
          "guides/authentication-with-jwt-bearer-and-refresh-tokens",
          "guides/authentication-with-a-third-party-oauth-provider",
          "guides/passwordless-authentication-with-webauthn",
       ],
    },
    {
       type: "category",
       collapsed: false,
       label: "SSL/TLS",
       link: { type: 'doc', id: "guides/securing-communication-with-ssl-tls" },
       items: [
          "guides/implementing-tls-with-self-signed-server-certificate",
          "guides/implementing-tls-with-root-ca-signed-server-certificate",
          "guides/implementing-tls-with-intermediate-ca-signed-server-certificate",
          "guides/implementing-mutual-tls",
       ],
    }

   ],

  sidebar: [
    "index",
    "installation",
    {
      type: "category",
      collapsed: false,
      label: "Concepts",
      items: ["concepts/routing", "concepts/middleware", "concepts/endpoint", "concepts/dev-mode"],
    },
  ],

  // But you can create a sidebar manually
  /*
  tutorialSidebar: [
    'intro',
    'hello',
    {
      type: 'category',
      label: 'Tutorial',
      items: ['tutorial-basics/create-a-document'],
    },
  ],
   */
};

module.exports = sidebars;
